<div id="room_informations">
	<label>Nom:</label>
	<%=h @room.name %>

	<% if current_user %>
		<br />

		<% if @room.id %>

			<%= link_to "Editer la salle",
							{:controller => :rooms, :action => :edit},
							:class => "button bg_orange edit"
							%>

		 	<% # can't delete riddance's room %>
			<%= link_to "Supprimer la salle",
							@room,
							:confirm => "Voulez-vous vraiment supprimer cette salle de la base de données ? Tout ordinateur présents dans celle-ci sera déplacé dans la salle de stockage.",
							:method => :delete,
							:class => "button bg_red delete"
							%>

			<%= link_to "Ajouter un ordinateur",
						{:controller => :computers, :action => :new, :room_id => @room.id},
						:class => "button add"
						%>
		<% end %>
	<% end %>
</div>

<% @computers.each do |computer| %>
	


	<div class="computer_section<% if current_user %> cursor_move<% end %>" id="computer_section_<%=h computer.id %>">
		<div class="computer_image">
			<%= image_tag "icons/host.png", :id=>"#{computer.id}", :title=>"Déplacer l'ordinateur" %>
			<br />
		</div>
		
		<div class="computer_informations">
			<%=h computer.name %>
			
			<% if @events.include? computer.id	#if computer.event.count > 0 %>
				
					<%= image_tag "icons/warning.png", :id=>"events_#{computer.id}", :title=>'Evènement(s) en cours', :class=>'cursor_help' %>
			<% end %>
			<br />

			Agent :
			<% if computer.state_agent %>
				<%= image_tag "icons/active.png", :id=>"agent_state_#{computer.id}", :title=>"Actif", :class=>'cursor_help' %>
			<% else %>
				<%= image_tag "icons/inactive.png", :id=>"agent_state_#{computer.id}", :title=>"Inactif", :class=>'cursor_help' %>
			<% end %><br />
			
			PC : 
			<% if computer.state_computer %>
				<%= image_tag "icons/active.png", :id=>"computer_state_#{computer.id}", :class=>'cursor_help' %>
			<% else %>
				<%= image_tag "icons/inactive.png", :id=>"computer_state_#{computer.id}", :class=>'cursor_help' %>
			<% end %>
				
			<%= link_to_remote image_tag("icons/ping.png", :title=>"Pinger l\'ordinateur"),
				{
					:url=>{:controller => "computers", :action => :ping, :id => computer.id},
					:before => "Element.show('wait_icon')",
					:loading=>visual_effect(:appear, "loader_computer_#{computer.id}"),
					:loaded=>visual_effect(:blind_up, "loader_computer_#{computer.id}", :duration => 2),
					:complete => "Element.hide('wait_icon')"
				},
				:href=>(url_for :controller => :computers, :action=>:ping, :id => computer.id)

			%>
			<%= image_tag('icons/ajax-loader.gif' ,:style =>'display:none',:id => "loader_computer_#{computer.id}") %><br />

			@ :
			<%=h computer.ip_computer %><br />

			RAM :
			<%=h computer.ram %> Mo<br />

			CPU :
			<%=h computer.cpu %> Ghz<br />
			
			<%= link_to image_tag("icons/zoom.png", :title=>"Afficher l'ordinateur"),
						computer,
						:action => :show,
						:id => computer.id
						 %>
			
			<% if current_user %>
				<%= link_to image_tag("icons/edit.png", :title=>"Modifier l'ordinateur"),
							edit_computer_path(computer)
							 %>
				
				<%= link_to_remote image_tag("icons/delete.png", :title=>"Supprimer l\'ordinateur"),
					{
						:url=>{:controller => :computers, :action => "destroy",:id => computer.id},
						:method => :delete,
						:confirm => "Voulez-vous vraiment supprimer cet ordinateur de la base de données ?",
						:before => "Element.show('wait_icon')",
						:complete => "Element.hide('wait_icon')",
						:success => "Element.hide('computer_section_#{computer.id}')"
					},:url=>{:controller => :computers, :action => "destroy",:id => computer.id}
					

				%>
			<% end %>
		</div>
	</div>

	<%
	# => Draggable only when user is connected
	if current_user
	%>
		<%= draggable_element("computer_section_#{computer.id}", :revert=>true,
								:complete => "Element.hide('wait_icon')"
							)
		%>
	<% end %>

<% end %>

<div class="clear_both"></div>

<div id="rooms_events">
	
</div>